package com.ciwong.epaper.modules.reciteWords.dbreciteword;


import android.text.TextUtils;

import com.ciwong.epaper.modules.evaluate.bean.WordDetail;

import java.util.List;

public class DBManager extends BaseDBManager {
    private String TAG = "DBManager";
    private static DBManager dbManager = null;
    private String NAME = "word_";

    private DBManager() {
        super();
    }

    public static DBManager getInstance() {
        if (null == dbManager)
            dbManager = new DBManager();
        return dbManager;
    }


    /**
     * 通过did 选出四个选项
     *
     * @param versionId
     * @param dId
     * @return
     */
    public List<WordDetail> getOptions(String versionId, String dId) {
        return executeGetOptions(versionId, dId);
    }

    /**
     * 获取did对应数据(同步)
     *
     * @param versionId
     * @param dId
     * @return
     */
    public void getDIdWordDetail(String versionId, String dId) {
        executeGetByDId(versionId, dId);
    }

    /**
     * 操作数据库插入数据
     *
     * @param versionId
     * @param wordDetails
     */
    public void add(String versionId, List<WordDetail> wordDetails) {
        executeAddData(versionId, wordDetails, null);
    }

    /**
     * 操作数据库插入数据，当数据存在时不插入
     *
     * @param versionId
     * @param wordDetails
     */
    public void addIfNoExist(String versionId, List<WordDetail> wordDetails) {
        executeaddIfNoExistData(versionId, wordDetails, null);
    }

    public void deleteAll(String versionId) {
        executeDeleteAll(versionId);
    }

    public List<WordDetail> queryAll(String versionId) {
        return executeQueryAll(versionId);
    }
}
